package com.longe.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * <p>
 * 接口文档配置类
 * </p>
 *
 * @author sky
 * @since 2022-09-25
 */
@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfiguration {

    @Bean(value = "dockerBean")
    public Docket dockerBean() {
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("ishow平台广告管理系统")
                        .description("广告管理平台的相关接口描述")
                        .termsOfServiceUrl("http://localhost:8080/doc.html")
                        .contact(new Contact("sky","url", "email"))
                        .version("1.0")
                        .build())
                //分组名称
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.longe.controller"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}